package day1024_3;

public class     E1 {

    public static void main(String[] args) {
        E1 e=new E1();
        try {
            e.test1( "zhangSan2"  ,  "123"  );
        } catch (RuntimeException runtimeException) {
            System.out.println(runtimeException.getMessage());
        }
    }

    public void test1(String name, String pwd)throws  RuntimeException{
        if("zhangSan".equals(name)  &&   "123".equals(pwd)  ){
            System.out.println("欢迎访问XXX网站");
        }else{//如果用户名密码错误，就将异常抛出给上一层。
            throw   new   RuntimeException("用户名或密码错误Exception");
        }
    }


}


